<template>
  <div>
    <!-- <h3>当前组件的count值为：{{ $store.state.count }}</h3> -->
    <h3>{{ $store.getters.showNum }}</h3>
    <button @click="addN">+n</button>
    <button @click="add1">+1</button>
    <button @click="AsyncAdd1">+1 async</button>
    <button @click="AsyncAddN(10)">+n async</button>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
export default {
  data() {
    return {}
  },
  methods: {
    ...mapActions(['AsyncAddN']),
    add1() {
      this.$store.commit('add1')
    },
    addN() {
      this.$store.commit('addN', 10)
    },
    AsyncAdd1() {
      this.$store.dispatch('AsyncAdd1')
    } /* ,
    AsyncAddN() {
      this.$store.dispatch('AsyncAddN', 10)
    } */
  }
}
</script>

<style></style>
